//
//  SummaryAirlineCell.swift
//  SwiftStudy
//
//  Created by Lewis Chen on 16/5/18.
//  Copyright © 2016年 mybox_1027@sina.com. All rights reserved.
//

import UIKit

public enum ESummaryAirlineStyle:String {
    case eSummaryAirlineReturn = "eSummaryAirlineReturn",
    eSummaryAirlineDepart = "eSummaryArilineDepart"
    
    func getMainColor() -> UIColor {
        switch self {
        case .eSummaryAirlineReturn:
            return UIColor.init(red: 1, green: 160.0/255.0, blue: 0, alpha: 1)//(colorLiteralRed: 246.0, green: 145.0, blue: 9.0, alpha: 255)
        case .eSummaryAirlineDepart:
            return UIColor.init(red: 0, green: 180.0/255.0, blue: 1, alpha: 1)
        }
    }
    
    func getTypeTitle() -> String {
        switch self {
        case .eSummaryAirlineReturn:
            return "Depart"
        case .eSummaryAirlineDepart:
            return "Return"
        }
    }
}

class SummaryAirlineCell: UITableViewCell {
    
    @IBOutlet weak var titleBackgroundView: UIView!
    @IBOutlet weak var labelType: UILabel!
    @IBOutlet weak var labelDate: UILabel!
    @IBOutlet weak var labelTime: UILabel!
    @IBOutlet weak var viewStartPoint: UIView!
    @IBOutlet weak var viewEndPoint: UIView!
    @IBOutlet weak var labelStartAirport: UILabel!
    @IBOutlet weak var labelEndAirport: UILabel!
    @IBOutlet weak var labelStartTime: UILabel!
    @IBOutlet weak var labelEndTime: UILabel!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        titleBackgroundView.layer.cornerRadius = titleBackgroundView.frame.height/2
        viewEndPoint.layer.cornerRadius = viewEndPoint.frame.height/2
        viewStartPoint.layer.cornerRadius = viewStartPoint.frame.height/2
    }
    
    func initCellStyle(type:ESummaryAirlineStyle) {
        self.titleBackgroundView.backgroundColor = type.getMainColor()
        self.viewStartPoint.backgroundColor = type.getMainColor()
        self.viewEndPoint.backgroundColor = type.getMainColor()
        self.labelStartAirport.textColor = type.getMainColor()
        self.labelEndAirport.textColor = type.getMainColor()
    }
}
